import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;


public class DestinationThread implements Runnable
{
DataInputStream di;
DataOutputStream d;
Socket client;
Destination dest;


	public DestinationThread(Socket client, Destination dest)
	{
	super();
	this.client = client;
	this.dest = dest;
	}


	@Override
	public void run() 
	{
		try 
		{
			
		di=new DataInputStream(client.getInputStream());
		d=new DataOutputStream(client.getOutputStream());
		String message=di.readUTF();
		if(!dest.jTextArea2.getText().equals(message))
		{
		
		dest.jTextArea2.setText(message);
		d.writeUTF("The Acknowledgement is received");
		
		}
		else
		{
			d.writeUTF("message is already received by the receiver");
		}
		
		
		} catch (IOException e) {
		
		e.printStackTrace();
	}
		
	}
	

}
